import request from '@/utils/request'
import { downFile } from '@/utils/request'

/**
 * 生产计划分页查询
 * @param {查询条件} data
 */
export function pageProdPlan(query) {
  return request({
    url: 'ProdManage/ProdPlan/pageList',
    method: 'get',
    params: query,
  })
}

/**
 * 新增生产计划
 * @param data
 */
export function addProdPlan(data) {
  return request({
    url: 'ProdManage/ProdPlan',
    method: 'post',
    data: data,
  })
}
/**
 * 修改生产计划
 * @param data
 */
export function updateProdPlan(data) {
  return request({
    url: 'ProdManage/ProdPlan',
    method: 'PUT',
    data: data,
  })
}
/**
 * 获取生产计划详情
 * @param {Id}
 */
export function getProdPlan(id) {
  return request({
    url: 'ProdManage/ProdPlan/' + id,
    method: 'get'
  })
}

/**
 * 删除生产计划
 * @param {主键} pid
 */
export function delProdPlan(pid) {
  return request({
    url: 'ProdManage/ProdPlan/delete',
    method: 'POST',
    data: pid
  })
}
// 导出生产计划
export async function exportProdPlan(query) {
  await downFile('ProdManage/ProdPlan/export', { ...query })
}
